/*
 * MyFirstFrame.java
 *
 * Created on 13 mars 2008, 13:41
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package TP05;

import javax.swing.*;
import java.awt.*;
    

/**
 *
 * @author Morgan
 */
public class MyFirstFrame extends javax.swing.JFrame{
    
    public MyFirstFrame(String title)
    {
      this.setTitle(title);
      this.setSize(500,400);
      this.setDefaultCloseOperation(EXIT_ON_CLOSE);
      this.setVisible(true); 
      
      // Un label
      JLabel myFirstLabel = new JLabel("Mon label 1");
      this.getContentPane().add(myFirstLabel);
      
      // Un boutton
      JButton myFirstButton = new JButton("OK");
      myFirstButton.setToolTipText("Ceci est une aide ...");
      myFirstButton.setEnabled(false);
      myFirstButton.setForeground(Color.YELLOW);
      myFirstButton.setBackground(Color.RED);
      this.getContentPane().add(myFirstButton);
      
      
      // Un champ de text
      JTextField myFirstTextField = new JTextField("Mon champ");
      myFirstTextField.setForeground(Color.RED);
      this.getContentPane().add(myFirstTextField);
      
      // Un champ de text area
      JTextArea myFirstTextArea = new JTextArea("Mon champ Area", 5, 10);
      myFirstTextArea.setEditable(false);
      this.getContentPane().add(myFirstTextArea);
      
      // 0 1 2 alignement gauche centre droit
      this.getContentPane().setLayout(new FlowLayout(0));
    }
    
    public MyFirstFrame()
    {
      this.setTitle("Without title !");
      this.setSize(500,400);
      this.setDefaultCloseOperation(EXIT_ON_CLOSE);
      this.setVisible(true); 
    }
    
    @SuppressWarnings("deprecation")
     public static void main(String[] args) {
     MyFirstFrame test =  new MyFirstFrame("ihi");
     test.show();
    }
}
